package com.googlecode.continuity.plugin.project.client;

import java.util.Date;
import java.util.Set;
import java.util.Iterator;
import java.util.HashSet;
import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * Milestone
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class Milestone implements IsSerializable, Serializable {
// ------------------------------ FIELDS ------------------------------

  private Date deadline;
  private String name;
  private String description;
  private int id;
  /**
   * @gwt.typeArgs <com.googlecode.continuity.plugin.project.client.Project>
   */
  private Set projects;
  private String requirements;

// --------------------- GETTER / SETTER METHODS ---------------------

  public Date getDeadline() {
    return deadline;
  }

  public void setDeadline(Date deadline) {
    this.deadline = deadline;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  private void setProjects(Set projects) {
    this.projects = projects;
  }

  protected void addProject(Project project) {
    getProjects().add(project);
  }

  public void removeProject(Project project) {
    getProjects().remove(project);
  }

  public Set getProjects() {
    if (projects == null) {
      projects = new HashSet();
    }
    return projects;
  }

  public String getRequirements() {
    return requirements;
  }

  public void setRequirements(String requirements) {
    this.requirements = requirements;
  }
}
